import functionnodes.FunctionNode;
import data.Value;

/**
 * @author loaner
 */
class functionnodes.FunctionNodeList extends FunctionNode {
	
	function FunctionNodeList() {
		super();
		funcname = "list";
	}
	
	public function reduceValues( scope:Object, args:Array):Value
	{
		//we are in fact receiving an array of Value objects.
		
		var returnval:Value;
		
		var temp:XML = new XML( "<list></list>");
		
		
		for( var i:Number = 0; i < args.length; i++ )
		{
			var newnode:XMLNode = args[ i ].getXML();
			temp.firstChild.appendChild( newnode );		
		}
		
		var tempnode:XMLNode = temp.firstChild; 
		trace("The XML I'm returning is " + tempnode );
		
		returnval = new Value( Value.XMLNODE, tempnode );
		return returnval;
	}

}